
module.exports = function ($scope, $state, $stateParams,$resource,$modal,$modalInstance,FileUploader,items) {  
    // console.log(items);
    $scope.employee={};
    // $scope.a={};
    $scope.fieldarr=[
        {name:'环保领域',value:'0'},
        {name:'城市建设领域',value:'1'},
        {name:'农药领域',value:'2'},
    ]
    var para={
        expert_code:items.expert_code
    }
    console.log(para);
    if(items.flag = '0'){
        $resource('/api/as/ggc/reviewexpertset/findInfoByCity', {}, {}).save(para, function(res){
            // console.log(res);
            if(res.errcode === 0){            
                $scope.a=res.data;
                console.log($scope.a);
            }else{
                alert(res.errmsg);
           
            }
        });
    }else{
        $resource('/api/as/ggc/reviewexpertset/findInfo', {}, {}).save(para, function(res){
            // console.log(res);
            if(res.errcode === 0){            
                $scope.a=res.data;
                console.log($scope.a);
            }else{
                alert(res.errmsg);
           
            }
        });
    }
     

    //正则判断电话号  
    $scope.checkphone=function(x){
        if(!/^1[34578]\d{9}$/.test(x)) return "您输入的电话号长度或格式错误";
    }
    $scope.showphoneinfo=function(x){
        console.log(x);
        if(x==undefined){
            $scope.employee.phoneinfo="";
            return;
        }
        if(x==''){
            $scope.employee.phoneinfo="";
            return;
        }
                                  
        if($scope.checkphone(x)=="您输入的电话号长度或格式错误"){                
            $scope.employee.phoneinfo="您输入的电话号长度或格式错误"
        }else{
            $scope.employee.phoneinfo="";
        }
    }

    var uploader = $scope.uploader = new FileUploader({
        url: 'http://cl.juyouhx.com/oss.php/oss/webuploader1?topdir=aa&selfdir=bb'
    });

    uploader.filters.push({
        name: 'imageFilter',
        fn: function(item /*{File|FileLikeObject}*/, options) {
            var type = '|' + item.type.slice(item.type.lastIndexOf('/') + 1) + '|';
            return '|jpg|png|jpeg|bmp|gif|'.indexOf(type) !== -1;
        }
    });
    
    
    uploader.onSuccessItem = function(fileItem, response, status, headers) {
        $scope.a.photo = response.savename;
    };

    $scope.close = function(){
      $modalInstance.close();
    }

};
